public class Solution2038 {
    public boolean winnerOfGame(String colors) {
        int a=0,b=0;
        int j=0;
        char[] chars=colors.toCharArray();
        for (int i=0;i<colors.length();i++){
            if (chars[i]!=chars[j]){
                if (chars[j]=='A'){
                    a+=Math.max(0,i-j-2);
                }else {
                    b+=Math.max(0,i-j-2);
                }
                j=i;
            }
        }
        if (chars[j]=='A'){
            a+=Math.max(0,colors.length()-j-2);
        }else {
            b+=Math.max(0,colors.length()-j-2);
        }
        return a>b;
    }

    public static void main(String[] args) {
        System.out.println(new Solution2038().winnerOfGame("ABBBBBBBAAA"));
    }
}
